package com.compass.doctor.ui.mine.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import com.compass.doctor.databinding.LayoutHospitalizedItemItemBinding
import com.compass.framework.adapter.BaseBindViewHolder
import com.compass.framework.adapter.BaseRecyclerViewAdapter
import com.compass.framework.ext.gone
import com.compass.framework.ext.visible
import com.compass.framework.model.MessageBody

/**
 * Description： 住院证item adapter
 * Date:2024/4/10 11:32
 */
class HospitalizedItemAdapter :
    BaseRecyclerViewAdapter<MessageBody, LayoutHospitalizedItemItemBinding>() {
    override fun onBindDefViewHolder(
        holder: BaseBindViewHolder<LayoutHospitalizedItemItemBinding>,
        item: MessageBody?,
        position: Int
    ) {
        if (item == null) return
        holder.binding.apply {
            tvTitle.text = item.itemTitle
            tvValue.text = item.itemValue

            if (position==getData().size-1){
                viewLine.gone()
            }else{
                viewLine.visible()
            }
        }
    }

    override fun getViewBinding(
        layoutInflater: LayoutInflater,
        parent: ViewGroup,
        viewType: Int
    ): LayoutHospitalizedItemItemBinding {
        return LayoutHospitalizedItemItemBinding.inflate(layoutInflater, parent, false)
    }
}